﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using HslCommunication.ModBus;
using WindowsFormsApp2.Common;
using WindowsFormsApp2.JiayuModelset;
using WindowsFormsApp2.ModbusRtuSet;

namespace YJYpublicClass
{
    public class 外设
    {
        //PLC
        public static TGQ_24V50 LightCtrl = new TGQ_24V50(); //实例化相机属性

        //public static PLC_modbus 汇川PLC = new PLC_modbus();

        public static NModbus4Rtu rtuClient = new NModbus4Rtu();
        public static CalModbus modbusServer = new CalModbus();

        public static SystemPras SysPras = new SystemPras();
        public static CalibDataList Calibdatas = new CalibDataList(); //与标定相关的参数类
        //
       // public static VisionMethod VPPmeth = new VisionMethod();
       // public static ModelCaozuo Jiayuchazhenmodel = new ModelCaozuo();

        //图像处理对象
        public static Cognex.VisionPro.ToolBlock.CogToolBlock _相机标定模块 = new Cognex.VisionPro.ToolBlock.CogToolBlock();
       // public static Cognex.VisionPro.ToolBlock.CogToolBlock _相机应用模块 = new Cognex.VisionPro.ToolBlock.CogToolBlock();

        public static ModelCaozuo jiayumodel = new ModelCaozuo();
        //可能还需要添加一个图像处理类
        //标定参数
    }
    //全局变量
    public class SystemPras
    {
       //第一部分路径相关参数,读取参数
        [Category("路径参数"), Description("string类型"), DisplayName("日志路径"), ReadOnly(false)]
        public string Logpath { get; set; }

        [Category("路径参数"), Description("string类型"), DisplayName("存图路径"), ReadOnly(false)]
        public string SaveImagepath { get; set; }

        [Category("路径参数"), Description("string类型"), DisplayName("标定VPP路径"), ReadOnly(false)]
        public string CalVpppath { get; set; }

        [Category("路径参数"), Description("string类型"), DisplayName("工程路径"), ReadOnly(false)]
        public string Vpppath { get; set; }

        //[Category("路径参数"), Description("string类型"), DisplayName("光源参数路径"), ReadOnly(false)]
        //public string Lightconfigpath { get; set; }

        //[Category("路径参数"), Description("string类型"), DisplayName("PLC参数路径"), ReadOnly(false)]
        //public string PLCconfigpath { get; set; }

        [Category("软件参数"), Description("string类型"), DisplayName("软件版本"), ReadOnly(false)]
        public string Appvision { get; set; }

        [Category("软件参数"), Description("INT类型"), DisplayName("存图间隔"), ReadOnly(false)]
        public int _间隔天 { get; set; }

        [Category("软件参数"), Description("string"), DisplayName("最近款式名"), ReadOnly(true)]
        public string _前次款式 { get; set; }

        public static string Appstartpath = System.AppDomain.CurrentDomain.BaseDirectory;
        //系统参数路径
        public static string SyspPrasFpath = Appstartpath + "SystemPara.xml";
        //系统参数路径
        [Category("软件参数"), Description("string类型"), DisplayName("标定文件路径"), ReadOnly(true)]
        public static string Calibfile { get; set; } = Appstartpath + "VPPFile\\CalibPara.xml";
        
        public static string Offsetfile = Appstartpath + "VPPFile\\OffsetPara.xml";
      //  public string VppFullpath { get; set; }
      //  public string CalFullVpppath { get; set; }

        public Boolean SaveImageFlag { get; set; } = true;
        public Boolean AutoGenghuanKuanFlag { get; set; } = true;

        public  SystemPras()
        {
          
            SaveImagepath = "D:\\SaveFile\\logs";
            Appvision = "V1.1.0_2024.07.30";
            CalVpppath =  "通用标定VPP.vpp";
            Vpppath =  "通用应用VPP.vpp";
            _间隔天 = 4;
         //   VppFullpath = Appstartpath + "VPPFile\\" + Vpppath;
         //  CalFullVpppath = Appstartpath + "VPPFile\\" + CalVpppath;

        }
    }
    //一些不好归类的全局变量
    public class PublicValue
    {
        public static int LoginRight=1;
        public static string SystemIniPath="生产统计.ini";
        //也要保存，有的时候
        public static int TopOk = 0;
        public static int TopNg = 0;
        public static int LowOk = 0;
        public static int LowNg = 0;
        public static DateTime _chanliangdata;

        public static int sleepTime = 0;
    }

}
